package com.example.gamestore.service.Impl;

import com.example.gamestore.mapper.ReviewMapper;
import com.example.gamestore.pojo.Review;
import com.example.gamestore.service.ReviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zihao
 * @date 2025/6/10 13:55
 * @VERSION
 * @description
 **/
@Service
public class ReviewServiceImpl implements ReviewService {
    @Resource
    private ReviewMapper reviewMapper;

    @Override
    public Review add(Review review) {
        int rows = reviewMapper.add(review);
        if (rows > 0) {
            return review;
        }
        return null;
    }
    @Override
    public List<Review> queryAll() {
        return reviewMapper.queryAll();
    }

    @Override
    public Review queryById(Long id) {
        return reviewMapper.queryById(id);
    }

    @Override
    public int updateReview(Review review) {
        return reviewMapper.updateReview(review);
    }

    @Override
    public int delete(Long id) {
        return reviewMapper.delete(id);
    }

    @Override
    public List<Review> queryByGameId(Long gameId) {
        return reviewMapper.queryByGameId(gameId);
    }
}
